package com.qdu.servlet;

import com.qdu.entity.Comment;
import com.qdu.entity.User;
import com.qdu.service.CommentService;
import com.qdu.service.impl.CommentServiceImpl;
import java.io.IOException;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 *
 * @author Ice
 */
@WebServlet("/vmbcls1")
public class ViewMyBookCommentListServlet extends HttpServlet {

    CommentService commentService = new CommentServiceImpl();

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        User user = new User();
        HttpSession session = req.getSession();
        user = (User) session.getAttribute("user");
        int uid = user.getId();// 得到该登录用户的id号

        List<Object[]> commentList = commentService.findCommentBookListById(uid);

        req.setAttribute("mybookcommentList", commentList);
        req.getRequestDispatcher("/Mybookcomment.jsp").include(req, resp);
    }

}
